const KEY_NAME = "my_storage";

const set = (key: string, value: any) => {
  localStorage.setItem(KEY_NAME + key, JSON.stringify(value));
};

const get = (key: string) => {
  const value = localStorage.getItem(KEY_NAME + key);
  return value ? JSON.parse(value) : null;
};

const remove = (key: string) => {
  localStorage.removeItem(KEY_NAME + key);
};

const clear = () => {
  localStorage.clear();
};

export default {
  set,
  get,
  remove,
  clear,
};
